﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Business;

namespace WebApplication1
{
    public partial class Changepassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void bntSubmit_Click(object sender, EventArgs e)
        {
            UserManagement usermgt = new UserManagement();
            User userobj = new User();
            userobj = (User)Session["User"];
            try
            {
                usermgt.ChangePassword(userobj.id, txtOldPassword.Text, txtNewPassword.Text, txtRetypePassword.Text);
                divMessage.Visible = true;
                divMessage.CssClass ="alert alert-success  alert-dismissible";
                lblMessage.Text = "Password is successfully changed!";
            }
            catch (Exception ex)
            {
                divMessage.Visible = true;
                divMessage.CssClass = "alert alert-danger  alert-dismissible";
                lblMessage.Text = ex.Message;
            }
        }
    }
}